<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //get()方法可以继承


        let proxy = new Proxy({}, {
            get(target, propkey, receiver) {
                //实现私有属性读取保护
            if(propkey[0] === '_') {
                throw new Erro(`Invalid attempt to get private    "${propkey}" `);
            }
            console.log('Getting' + propkey);
            return target[propkey];
            }
        });

        let obj = Object.create(proxy);
        obj.name
        //Getting name
    </script>
</body>
</html>